Bundler Fixes#23
Conversation
There was a problem hiding this comment.
Bug: Crypto Shim Fails Across Environments
The crypto-shim.js attempts to provide a synchronous Web Crypto API shim, but it is fundamentally flawed and incompatible across environments. Its digestSync implementation uses SharedArrayBuffer and Atomics.wait(). This approach is problematic in browsers because SharedArrayBuffer is often disabled or requires specific cross-origin isolation headers (e.g., COEP/COOP) due to security concerns (Spectre/Meltdown mitigations), and Atomics.wait() blocks the main thread, freezing the UI. Additionally, the shim mixes Node.js (Buffer) and browser (window) APIs, causing ReferenceError in Node.js (due to window access) or in browsers (due to Buffer usage without polyfill).
scripts/crypto-shim.js#L29-L84
sensemaker/scripts/crypto-shim.js
Lines 29 to 84 in d1ae923
Bug: Async Initialization and Incorrect Graphviz Option
The initializeGraph() method was changed to async but its callers are not updated to await it, potentially causing incomplete graph initialization. Furthermore, the graphviz instance loaded from @hpcc-js/wasm is incorrectly passed as a graphviz option to d3.select().graphviz(), which does not accept it, making the async loading ineffective.
components/GraphContent.js#L110-L125
sensemaker/components/GraphContent.js
Lines 110 to 125 in d1ae923
Bug: Duplicate Text in Paragraph
The paragraph under the "Fine-Tunable at Will" header contains duplicated text. The sentence "SENSEMAKER uses its entire history of interactions with the user to personalize each experience, typically leading to high-quality results from the processing pipeline." is copied from the preceding paragraph and appended without proper spacing or punctuation.
components/FeaturesHome.js#L58-L59
sensemaker/components/FeaturesHome.js
Lines 58 to 59 in d1ae923
Bug: Crypto Hash Method Calls Undefined Function
The crypto.createHash().digest() method calls window.crypto.subtle.digestSync() before digestSync is defined and attached to window.crypto.subtle later in the same file, causing a runtime error. Additionally, the code lacks checks for the existence of window or window.crypto.subtle, leading to ReferenceError in Node.js or failures in environments without the Web Crypto API.
scripts/crypto-shim.js#L41-L42
sensemaker/scripts/crypto-shim.js
Lines 41 to 42 in d1ae923
Was this report helpful? Give feedback by reacting with 👍 or 👎
Fix the bundler.